package hui.zhang.web.action.take_delivery;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import hui.zhang.domain.take_delivery.Order;
import hui.zhang.service.take_delivery.OrderService;
import hui.zhang.utils.BaseAction;
/**
 * 订单
 * @author hui.zhang
 * @date 2017年12月26日 下午8:40:08
 */

@ParentPackage("struts-default")
@Namespace("/")
@Scope("prototype")
@Controller
@SuppressWarnings("all")
public class OrderAction extends BaseAction<Order> {
	
	@Autowired
	private OrderService orderService;
	
	// 异步通过订单编号查找
	@Action(value="order_findByOrderNum")
	public String findByOrderNum() {
		Order order = orderService.findByOrderNum(model.getOrderNum());
		Map<String, Object> result = new HashMap<String, Object>();
		if(order == null) {
			// 订单号不存在
			result.put("success", false);
		} else {
			result.put("success", true);
			result.put("orderData", order);
		}
		toJsonAndResponse(result);
		return NONE;
	}

}
